import {
  IsNotEmpty,
  IsString,
  MinLength,
  MaxLength,
  IsOptional,
  IsDate,
  Min,
  Max,
  ArrayNotEmpty,
  IsInt,
  IsNumber,
} from 'class-validator';
import { ApiErrorCode } from '../../common/enums/api-error-code.enum';
import { plainToClass, Exclude, Type } from 'class-transformer';
import { AdminRole, UserRole } from 'src/entities/user.entity';

export class CreateToAdminDto {
  @IsNotEmpty({ message: '手机号不能为空' })
  readonly phone: string;

  @IsNotEmpty({ message: '密码不能为空' })
  readonly password: string;

  @IsNotEmpty({ message: '用户权限不能为空' })
  readonly userRole: UserRole;
}

export class PgaeDto {
  @Type(() => Number)
  @Min(1, { message: 'page不能小于1' })
  @IsNotEmpty({ message: 'page不能为空' })
  readonly page: number;

  @Type(() => Number)
  @IsNotEmpty({ message: 'pageSize不能为空' })
  readonly pageSize: number;

  readonly name: string;
}
export class SetClientUserInfoDto {
  @IsNotEmpty({ message: '头像不能为空' })
  readonly userAvatarUrl: string;

  @IsNotEmpty({ message: '昵称不能为空' })
  readonly userName: string;

  @IsNotEmpty({ message: 'openid不能为空' })
  readonly openid: string;
}
